import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";
import vuejsx from "@vitejs/plugin-vue-jsx";
import viteCompression from "vite-plugin-compression";

// https://vitejs.dev/config/
export default defineConfig({
    define: {
        __VUE_PROD_HYDRATION_MISMATCH_DETAILS__: true
    },
    server: {
        hmr: true,
        // host: "localhost",
        host: "192.168.31.196",
        port: "8008",
    },
    build: {
        sourcemap: false,
        outDir: "web",
        emptyOutDir: true,
    },
    plugins: [
        vue(),
        vuejsx(),
        viteCompression({
            ext: ".gz",
            algorithm: "gzip",
            deleteOriginFile: false,
        }),
    ],
    resolve: {
        alias: {
            "@": path.join(__dirname, "./src"),
            "@business": path.join(__dirname, "./business"),
        },
    },
    esbuild: {
        jsxFactory: "h",
        jsxFragment: "Fragment",
    },
    css: {
        preprocessorOptions: {
            less: {
                javascriptEnabled: true,
            },
            scss: {
                api: 'modern-compiler'
            },
        },
    },
});
